/**
 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.vijayan.profile.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import com.vijayan.profile.model.MyPhoto;
import com.vijayan.profile.model.MyPhotoModel;
import com.vijayan.profile.model.MyPhotoSoap;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

import java.util.ArrayList;
import java.util.List;

/**
 * The base model implementation for the MyPhoto service. Represents a row in the &quot;kalyan_photo&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.vijayan.profile.model.MyPhotoModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link MyPhotoImpl}.
 * </p>
 *
 * <p>
 * Never modify or reference this class directly. All methods that expect a my photo model instance should use the {@link com.vijayan.profile.model.MyPhoto} interface instead.
 * </p>
 *
 * @author vijayan
 * @see MyPhotoImpl
 * @see com.vijayan.profile.model.MyPhoto
 * @see com.vijayan.profile.model.MyPhotoModel
 * @generated
 */
public class MyPhotoModelImpl extends BaseModelImpl<MyPhoto>
	implements MyPhotoModel {
	public static final String TABLE_NAME = "kalyan_photo";
	public static final Object[][] TABLE_COLUMNS = {
			{ "photoId", new Integer(Types.BIGINT) },
			{ "profileId", new Integer(Types.BIGINT) },
			{ "content", new Integer(Types.VARCHAR) },
			{ "width", new Integer(Types.INTEGER) },
			{ "height", new Integer(Types.INTEGER) },
			{ "type_", new Integer(Types.VARCHAR) },
			{ "thumbnail", new Integer(Types.BOOLEAN) }
		};
	public static final String TABLE_SQL_CREATE = "create table kalyan_photo (photoId LONG not null primary key,profileId LONG,content VARCHAR(75) null,width INTEGER,height INTEGER,type_ VARCHAR(75) null,thumbnail BOOLEAN)";
	public static final String TABLE_SQL_DROP = "drop table kalyan_photo";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.vijayan.profile.model.MyPhoto"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.vijayan.profile.model.MyPhoto"),
			true);

	/**
	 * Converts the soap model instance into a normal model instance.
	 *
	 * @param soapModel the soap model instance to convert
	 * @return the normal model instance
	 */
	public static MyPhoto toModel(MyPhotoSoap soapModel) {
		MyPhoto model = new MyPhotoImpl();

		model.setPhotoId(soapModel.getPhotoId());
		model.setProfileId(soapModel.getProfileId());
		model.setContent(soapModel.getContent());
		model.setWidth(soapModel.getWidth());
		model.setHeight(soapModel.getHeight());
		model.setType(soapModel.getType());
		model.setThumbnail(soapModel.getThumbnail());

		return model;
	}

	/**
	 * Converts the soap model instances into normal model instances.
	 *
	 * @param soapModels the soap model instances to convert
	 * @return the normal model instances
	 */
	public static List<MyPhoto> toModels(MyPhotoSoap[] soapModels) {
		List<MyPhoto> models = new ArrayList<MyPhoto>(soapModels.length);

		for (MyPhotoSoap soapModel : soapModels) {
			models.add(toModel(soapModel));
		}

		return models;
	}

	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.vijayan.profile.model.MyPhoto"));

	public MyPhotoModelImpl() {
	}

	public long getPrimaryKey() {
		return _photoId;
	}

	public void setPrimaryKey(long pk) {
		setPhotoId(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_photoId);
	}

	public long getPhotoId() {
		return _photoId;
	}

	public void setPhotoId(long photoId) {
		_photoId = photoId;
	}

	public long getProfileId() {
		return _profileId;
	}

	public void setProfileId(long profileId) {
		_profileId = profileId;
	}

	public String getContent() {
		if (_content == null) {
			return StringPool.BLANK;
		}
		else {
			return _content;
		}
	}

	public void setContent(String content) {
		_content = content;
	}

	public int getWidth() {
		return _width;
	}

	public void setWidth(int width) {
		_width = width;
	}

	public int getHeight() {
		return _height;
	}

	public void setHeight(int height) {
		_height = height;
	}

	public String getType() {
		if (_type == null) {
			return StringPool.BLANK;
		}
		else {
			return _type;
		}
	}

	public void setType(String type) {
		_type = type;
	}

	public boolean getThumbnail() {
		return _thumbnail;
	}

	public boolean isThumbnail() {
		return _thumbnail;
	}

	public void setThumbnail(boolean thumbnail) {
		_thumbnail = thumbnail;
	}

	public MyPhoto toEscapedModel() {
		if (isEscapedModel()) {
			return (MyPhoto)this;
		}
		else {
			return (MyPhoto)Proxy.newProxyInstance(MyPhoto.class.getClassLoader(),
				new Class[] { MyPhoto.class }, new AutoEscapeBeanHandler(this));
		}
	}

	public ExpandoBridge getExpandoBridge() {
		if (_expandoBridge == null) {
			_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
					MyPhoto.class.getName(), getPrimaryKey());
		}

		return _expandoBridge;
	}

	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		getExpandoBridge().setAttributes(serviceContext);
	}

	public Object clone() {
		MyPhotoImpl clone = new MyPhotoImpl();

		clone.setPhotoId(getPhotoId());
		clone.setProfileId(getProfileId());
		clone.setContent(getContent());
		clone.setWidth(getWidth());
		clone.setHeight(getHeight());
		clone.setType(getType());
		clone.setThumbnail(getThumbnail());

		return clone;
	}

	public int compareTo(MyPhoto myPhoto) {
		long pk = myPhoto.getPrimaryKey();

		if (getPrimaryKey() < pk) {
			return -1;
		}
		else if (getPrimaryKey() > pk) {
			return 1;
		}
		else {
			return 0;
		}
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		MyPhoto myPhoto = null;

		try {
			myPhoto = (MyPhoto)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long pk = myPhoto.getPrimaryKey();

		if (getPrimaryKey() == pk) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return (int)getPrimaryKey();
	}

	public String toString() {
		StringBundler sb = new StringBundler(15);

		sb.append("{photoId=");
		sb.append(getPhotoId());
		sb.append(", profileId=");
		sb.append(getProfileId());
		sb.append(", content=");
		sb.append(getContent());
		sb.append(", width=");
		sb.append(getWidth());
		sb.append(", height=");
		sb.append(getHeight());
		sb.append(", type=");
		sb.append(getType());
		sb.append(", thumbnail=");
		sb.append(getThumbnail());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(25);

		sb.append("<model><model-name>");
		sb.append("com.vijayan.profile.model.MyPhoto");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>photoId</column-name><column-value><![CDATA[");
		sb.append(getPhotoId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>profileId</column-name><column-value><![CDATA[");
		sb.append(getProfileId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>content</column-name><column-value><![CDATA[");
		sb.append(getContent());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>width</column-name><column-value><![CDATA[");
		sb.append(getWidth());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>height</column-name><column-value><![CDATA[");
		sb.append(getHeight());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>type</column-name><column-value><![CDATA[");
		sb.append(getType());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>thumbnail</column-name><column-value><![CDATA[");
		sb.append(getThumbnail());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _photoId;
	private long _profileId;
	private String _content;
	private int _width;
	private int _height;
	private String _type;
	private boolean _thumbnail;
	private transient ExpandoBridge _expandoBridge;
}